import dao.AdminDao;
import dao.ProductDao;
import dao.UserDao;
import dao.impl.AdminDaoimpl;
import dao.impl.ProductDaoimpl;
import dao.impl.UserDaoimpl;
import org.junit.Test;
import pojo.Admin;
import pojo.Product;
import pojo.User;

import java.sql.SQLException;
import java.util.List;

/**
 * @author LiangHaiBo
 * @version 1.0
 * @date 2021.8.31 下午 13:46
 */
public class testDemo {
    @Test
    public void test(){
        AdminDao adminDao = new AdminDaoimpl();
        Admin allByname = adminDao.findAllByname("zhaosi");
        System.out.println(allByname);

    }

    @Test
    public  void fandalluser(){
        AdminDao adminDao = new AdminDaoimpl();
        List<User> list = adminDao.selectUserAll();
        for (User user : list) {
            System.out.println(user);
        }
    }

    @Test
    public  void findUserbyid(){
        AdminDao adminDao = new AdminDaoimpl();
        User user = adminDao.getUserById("373eb242933b4f5ca3bd43503c34668b");
        System.out.println(user);
    }

    @Test
    public void selectuserByname(){
        UserDao userDao = new UserDaoimpl();
        User user = userDao.selectUserByName("铁锤");
        System.out.println(user);
    }

    @Test
    public  void selectUserbyUsername(){
        UserDao userDao = new UserDaoimpl();
        User u = userDao.findAllByusername("白雪公主");
        System.out.println(u);
    }

    @Test
    public  void SelectProductBYid() throws SQLException {
        ProductDao productDao = new ProductDaoimpl();
        Product product = productDao.selectProductById("7");
        System.out.println(product);

    }
}
